<extend name="Public/base"/>
<block name="body">
    <iframe id="market" src="{:cloud_url()}/index.php?s=/appstore.html" name="main" width="100%" height="100%"
            frameborder="0" scrolling="yes" style="overflow-x: scroll;bottom: 0;position: absolute;top: 0"></iframe>

    <form id="install_form" action="{:U('Admin/Cloud/install')}" method="post">
        <input id="install_token" type="hidden" name="token">
        <input id="install_cookie" type="hidden" name="cookie">
    </form>
    <script>
        var website_title = "{:modC('WEB_SITE_NAME','','config')}";
        window.addEventListener('message', function (event, domain) {
            if (event.data.type == 'getWebSiteInfo') {
                document.getElementById("market").contentWindow.postMessage({
                    'type': 'returnWebSiteInfo',
                    'domain': window.location.host,
                    'title': website_title
                }, '*');
            }
            if (event.data.type == 'install') {
                $('#install_token').val(event.data.token);
                $('#install_cookie').val(event.data.cookie);
                $('#install_form').submit();
            }
        });
        var wid = document.body.clientWidth ;
        var ifarmeWidth = parseInt((1-(200/wid))*100)+'%' ;
        document.getElementById("market").style.width = ifarmeWidth ;
    </script>
</block>